uniform sampler2D texture;
uniform bool disabled;
uniform bool selected;
uniform bool pressed;
uniform vec4 selectedColor;
uniform vec2 pressedOffset;
varying vec2 vTexCoord;
void main() {
	if(disabled) {
		vec4 color = texture2D(texture, vTexCoord);
		float pix = (color.r + color.g + color.b) / 3;
		gl_FragColor = vec4(pix, pix, pix, color.a);
	} else {
		vec4 color = texture2D(texture, pressed ? vTexCoord + pressedOffset : vTexCoord);
    	gl_FragColor = vec4(selected ? mix(color.rgb, selectedColor.rgb, selectedColor.a) : color.rgb, color.a);
    }
}